import 'package:flutter/material.dart';

import 'HomePage.dart';

/// APP 核心入口文件

void main() {
  runApp(new LoginMain());
}

class LoginMain extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: new ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        body: new LoginHomePage(),
      ),
    );
  }
}

class LoginHomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new _LoginHomePageState();
  }
}

class _LoginHomePageState extends State<LoginHomePage> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Stack(
      children: <Widget>[
        Column(
          mainAxisSize: MainAxisSize.max,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(left: 34, top: 191),
              child: Text('你好，\n欢迎来到询药',
                  style: TextStyle(
                      color: Colors.black,
                      fontWeight: FontWeight.bold,
                      fontSize: 24)),
            ),
            Container(
              margin: EdgeInsets.only(left: 34, right: 34, top: 40),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  TextField(
                      autofocus: true,
                      decoration: InputDecoration(
                        hintText: "请输入11位手机号",
                      )),
                  TextField(
                    decoration: InputDecoration(
                        hintText: "请输入验证码",
                        suffixStyle: TextStyle(color: Colors.blue),
                        suffixText: "获取验证码"),
                    obscureText: true,
                  ),
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(left: 34, right: 34, top: 60),
              width: double.infinity,
              height: 50,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage("assets/images/Group.png")),
              ),
              child: Text(
                "确定",
                style: TextStyle(color: Colors.white),
              ),
//              child: FlatButton(
//                  color: Colors.blue,
//                  // 设置斜角矩形边框
//                  shape: RoundedRectangleBorder(
//                      borderRadius: BorderRadius.circular(20.0)),
//                  // 确保文字按钮为深色
//                  colorBrightness: Brightness.dark,
//                  onPressed: () => print('FlatButton pressed'),
//                  child: Text("Add")),
            ),
            Container(
              margin: EdgeInsets.only(left: 34, right: 34, top: 200),
//              alignment: Alignment.topCenter,
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 16,
                    child: Divider(height: 1, color: const Color(0XFFCCCCCC)),
                  ),
                  Expanded(
                      flex: 12,
                      child: Padding(
                          padding: EdgeInsets.only(left: 5, right: 5),
                          child: Text(
                            "第三方登录",
                            textAlign: TextAlign.center,
                            style: TextStyle(color: const Color(0XFFCCCCCC)),
                          ))),
                  Expanded(
                    flex: 16,
                    child: Divider(height: 1, color: const Color(0XFFCCCCCC)),
                  ),
                ],
              ),
            ),
            Container(
                margin: EdgeInsets.only(left: 34, right: 34, top: 20),
                height: 55,
                alignment: Alignment.center,
////                decoration: BoxDecoration(
////                  image: DecorationImage(
////                      image: AssetImage("assets/images/wechat.png")),
////                ),
                child: FlatButton(
                  onPressed: () {
                    print('FlatButton pressed');
                  },
                  child: Image(image: AssetImage("assets/images/Wechat.png")),
                )),
            Container(
              alignment: Alignment.center,
              margin: EdgeInsets.only(left: 34, right: 34, top: 20),
              child: RichText(
//                textAlign: TextAlign.center,
                text: TextSpan(
                    style: DefaultTextStyle.of(context).style,
                    children: [
                      TextSpan(
                          text: '注册/登录即表示同意',
                          style: TextStyle(color: const Color(0XFF999999))),
                      TextSpan(
                          text: '《询药用户协议》',
                          style: TextStyle(
                            decoration: TextDecoration.underline,
                            color: const Color(0xff366BFF),
                          ))
                    ]),
              ),
            )
          ],
        ),
      ],
    );
  }
}
